<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:asp="http://southchina-logistics.com/nywl/asp"  xmlns:uc1="http://southchina-logistics.com/uc1" xmlns:dxwtl="http://southchina-logistics.com/dxwtl" xmlns:dxcp="http://southchina-logistics.com/dxcp" xmlns:dxp="http://southchina-logistics.com/dxp" xmlns:dxe="http://southchina-logistics.com/dxe" xmlns:dxwgv="http://southchina-logistics.com/dxwgv">
<xsl:output method="xml" version="1.0" encoding="gb2312" indent="yes"/>

<xsl:include href="page_aspx.xslt" />

<xsl:template match="EntityMeta">

	<!-- 定义常用变量 -->
	<xsl:variable name="TableName" select="TableName" />
	<xsl:variable name="KeyField" select="KeyField" />
	<xsl:variable name="MdlName" select="GenConfig/MdlConfig/ClassName" />
	<xsl:variable name="MdlNamespace" select="GenConfig/MdlConfig/Namespace" />
	<xsl:variable name="BllName" select="GenConfig/BllConfig/ClassName" />	
	<xsl:variable name="BllNamespace" select="GenConfig/BllConfig/Namespace" />

<!-- 产生CodeBehind	-->
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>%@ Page Language="C#" MasterPageFile="~/grid.master" AutoEventWireup="true" CodeFile="<xsl:value-of select="TableName" />Management.aspx.cs"
    Inherits="UI_<xsl:value-of select="TableName" />" Title="Untitled Page" %<xsl:text disable-output-escaping="yes">&gt;</xsl:text><xsl:text>
</xsl:text>

<!-- 产生使用到的页面控件的定义 -->
<xsl:call-template name="UseControls" />

<!-- 主体内容 -->
<asp:Content ID="Content2" ContentPlaceHolderID="C2" runat="Server">
	<script type="text/javascript" src="../Script/Common.js"></script>
    <dxcp:ASPxCallbackPanel ID="ajaxPanel" ClientInstanceName="ajaxPanel"
        LoadingPanelText="数据加载中…" OnCallback="ajaxPanel_Callback" runat="server" HideContentOnCallback="False">
        <PanelCollection>
            <dxp:PanelContent runat="server">
                <div class="queryLine"></div>
                <div class="buttonLine">
                    <uc1:PageCommon ID="commonPageCtrl" GridClientName="InfoGrid" OnExport="btnExport_Click" runat="server" >
                    </uc1:PageCommon>
                </div>
                <div class="infoGrid">
                    <dxwgv:ASPxGridView ID="InfoGrid" ClientInstanceName="InfoGrid" 
                        DataSourceID = "dataSource"
                        KeyFieldName="{$KeyField}" Width="100%" runat="server"
                        OnCustomCallback="InfoGrid_CustomCallback"
                        OnInitNewRow="InfoGrid_InitNewRow"
                        OnRowDeleting="InfoGrid_RowDeleting"
                        OnRowValidating="InfoGrid_RowValidating" 
                        OnPreRender="InfoGrid_PreRender" AutoGenerateColumns="False" OnRowInserting="InfoGrid_RowInserting" OnRowUpdating="InfoGrid_RowUpdating"  >
                        <Columns>
                            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" >
                                <HeaderTemplate>
                                    <input title="[选择/取消选择]本页所有行" onclick="InfoGrid.SelectAllRowsOnPage(this.checked);"
                                        style="vertical-align: middle;" id="chkPageSelectAll" type="checkbox" />
                                </HeaderTemplate>
                                <HeaderStyle HorizontalAlign="Center" />
                            </dxwgv:GridViewCommandColumn>
                            <xsl:for-each select="Propertys/PropertyMeta">
								<xsl:call-template name="PropertyColumn"></xsl:call-template>
							</xsl:for-each>
                            
                            <dxwgv:GridViewCommandColumn Caption="操作" >
                                <EditButton Visible="True" ></EditButton>
                                <DeleteButton Visible="True"></DeleteButton>
                            </dxwgv:GridViewCommandColumn>
                        </Columns>
                   </dxwgv:ASPxGridView>
                </div>
            </dxp:PanelContent>
        </PanelCollection>
    </dxcp:ASPxCallbackPanel>
    <asp:ObjectDataSource ID="dataSource" runat="server" DataObjectTypeName="{$MdlNamespace}.{$MdlName}"
        TypeName="{$BllNamespace}.{$BllName}" 
        OnSelecting="dataSource_Selecting" SelectMethod="Select" 
        OnObjectCreating="ds_ObjectCreating">
        <SelectParameters>
        </SelectParameters>
    </asp:ObjectDataSource>
    <!-- 根据外键字段建立数据源 -->
    <xsl:for-each select="Propertys/PropertyMeta">
		<xsl:call-template name="CreateDataSource"></xsl:call-template>
	</xsl:for-each>
</asp:Content>


</xsl:template>

</xsl:stylesheet>
